programming4us
           
 
 
Windows Phone

Handling Input on Windows Phone 7 : The Keyboard

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
8/11/2011 5:18:09 PM
The last thing a mobile user wants to do is type on a mobile keyboard, but it is inevitable for many applications to require some form of text input. In this section I discuss keyboard capabilities and API enhancements to ease typing on the keyboard on Windows Phone 7 devices.

1. Physical Keyboard

Windows Phone 7 devices may also have a hardware slide-out keyboard, but your application will not pass certification in App Hub if it is dependent upon the hardware keyboard. Otherwise, from a software development perspective, programming for hardware keyboard input "just works." Of the six devices available at Windows Phone 7 launch, only one had a full slide-out keyboard, and another had a vertical QWERTY keyboard. The other four devices were pure touch devices without a physical keyboard.

2. Soft Input Panel (SIP) Keyboard

All Windows Phone 7 devices have a SIP keyboard used for entering text. Typing on the SIP keyboard built into Windows Phone 7 is a pretty comfortable means of entering text; however, it is still a small keyboard, so anything that a developer can do to ease typing can really help improve the overall user experience.

3. Programming with the Keyboard

Typing text on a mobile phone should be minimized as much as possible, but if text input is required, a developer should take advantage of capabilities to make typing as simple as possible. In the next section I cover InputScope, which is a must-have feature to take advantage of when typing is required in your Windows Phone 7 applications.

When testing keyboard input, you will be tempted to type on your PC keyboard; however, it does not work. You must use the mouse with the SIP keyboard in the Emulator for input.

Click the Pause/Break button on your PC keyboard to enable typing in the emulator with your PC keyboard instead of having to use the mouse to "touch" the SIP.


3.1. InputScope

The InputScope property is available on the TextBox control, which is the primary control for text input. InputScope lets the developer customize the keyboard for the expected type of input. For example, the default behavior is that when you click into a TextBox, the SIP keyboard pops up, as shown in Figure 1.

Figure 1. Default SIP keyboard

The second TextBox has an InputScope of Text, which enables word selection just above the keyboard, as shown in Figure 2.

Figure 2. InputScope of Text SIP keyboard with word suggestion

With just one simple attribute, text input becomes much easier for the enduser. Figure 3 shows three additional text input options, which I explain just after the figure.

Figure 3. Search, Password, and TelephoneNumber InputScopecustomizations

Configuring an InputScope of Search turns the Enter key into a GO key with the idea that the user enters a search keyword and then clicks Enter to kick off a search. Password is not actually an InputScope. It is a custom TextBox class named PasswordBox that automatically hides data entry as the user types. An InputScope of TelephoneNumber brings up a phone keypad. As you can see, all of these could come in handy as you develop your application UI and optimize input for the end user. Table 1 lists the available InputScope options and their descriptions, reprinted here for your convenience from the Windows Phone 7 documentation.

Table 1. Available InputScope Options
Input ScopeDescription
AddressCityThe text input pattern for a city address.
AddressCountryNameThe text input pattern for the name of a country/region.
AddressCountryShortNameThe text input pattern for the abbreviated name of a country/region.
dAdressStateOrProvinceThe text input pattern for a state or province.
AddressStreetThe text input pattern for a street address.
AlphanumericFullWidthThe text input pattern for alphanumeric full-width characters (East-Asian languages only).
AlphanumericHalfWidthThe text input pattern for alphanumeric half-width characters(East-Asian languages only).
ChatThe SIP layout for text messaging, which recognizes pre-defined abbreviations. Supported only in Silverlight for Windows Phone.
CurrencyAmountThe text input pattern for amount of currency.
CurrencyAmountAndSymbolThe text input pattern for amount and symbol of currency.
CurrencyChineseThe text input pattern for Chinese currency.
DateThe text input pattern for a calendar date.
DateDayThe text input pattern for the numeric day in a calendar date.
DateDayNameThe text input pattern for the name of the day in a calendar date.
DateMonthThe text input pattern for the numeric month in a calendar date.
DateMonthNameThe text input pattern for the name of the month in a calendar date.
DateYearThe text input pattern for the year in a calendar date.
DefaultThe default handling of input commands.
DigitsThe text input pattern for digits.
EmailNameOrAddressThe SIP layout for an e-mail name or address. Supported only in Silverlight for Windows Phone.
EmailSmtpAddressThe text input pattern for a Simple Mail Transfer Protocol (SMTP) e-mail address.
EmailUserNameThe text input pattern for an e-mail user name.
FileNameThe text input pattern for a file name.
FullFilePathThe text input pattern for the full path of a file.
HanjaThe text input pattern for Hanja characters (Korean characters).
HiraganaThe text input pattern for the Hiragana writing system(a Japanese syllabary).
KatakanaFullWidthThe text input pattern for full-width Katakana characters (a Japanese syllabary).
KatakanaHalfWidthThe text input pattern for half-width Katakana characters (a Japanese syllabary).
LogOnNameThe text input pattern for a log on name.
MapsThe SIP layout for entering a map location. Supported only in Silverlight for Windows Phone.
NameOrPhoneNumberThe SIP layout for SMS To field. Supported only in Silverlight for Windows Phone.
NumberThe text input pattern for a number.
NumberFullWidthThe text input pattern for a full-width number.
OneCharThe text input pattern for one character.
PasswordThe text input pattern for a password.
PersonalFullNameThe text input pattern for a person's full name.
PersonalGivenNameThe text input pattern for a person's given name.
PersonalMiddleNameThe text input pattern for a person's middle name.
PersonalNamePrefixThe text input pattern for the prefix of a person's name.
PersonalNameSuffixThe text input pattern for the suffix of a person's name.
PersonalSurnameThe text input pattern for a person's surname.
PhraseListThe text input pattern for a phrase list.
PostalAddressThe text input pattern for a postal address.
PostalCodeThe text input pattern for a postal code.
RegularExpressionThe text input pattern for a regular expression.
SearchThe SIP layout for a search query. Supported only in Silverlight for Windows Phone.
SrgsThe text input pattern for the Speech Recognition Grammar Specification (SRGS).
TelephoneAreaCodeThe text input pattern for a telephone area code.
TelephoneCountryCodeThe text input pattern for a telephone country/region code.
TelephoneLocalNumberThe text input pattern for a telephone local number.
TelephoneNumberThe text input pattern for a telephone number.
TextThe software input panel (SIP) layout for standard text input. Supported only in Silverlight for Windows Phone.
TimeThe text input pattern for the time.
TimeHourThe text input pattern for the hour of the time.
TimeMinorSecThe text input pattern for the minutes or seconds of time.
UrlThe text input pattern for a Uniform Resource Locator (URL).
XmlThe text input pattern for XML.

Let's now shift gears and explore the available keyboard events.

3.2. Keyboard Events

There are two keyboard events available on the TextBox, as well as pretty much any other object that inherits from UIElement: the KeyDown and KeyUp events. Both events have a KeyEventArgs class in its parameters that provides access to the Key and PlatformKeyCode values native to the platform. It also provides access to the OriginalSource property that represents the control that raised the Keyboard event, as well as a Handled member to indicate that the key has been processed.

This completes our discussion of keyboard events. In general, typing should be minimized in a mobile application for the reasons listed previously, i.e., small screen, small keyboard, and so on. Mobile devices are optimized for touch input, especially modern devices with highly responsive capacitive touch screens that do not require a stylus. Let's now focus on touch input.

Other -----------------
- User Interface : Customizing the Soft Input Panel Keyboard to Accept Only Numbers
- User Interface : Detecting Changes in the Theme Template
- Developing for Windows Phone and Xbox Live : Multiplayer Games (part 6) - Searching for an Available Network Session
- Developing for Windows Phone and Xbox Live : Multiplayer Games (part 5) - Searching for an Available Network Session
- Developing for Windows Phone and Xbox Live : Multiplayer Games (part 4) - Building a Game Lobby
- Developing for Windows Phone and Xbox Live : Multiplayer Games (part 3) - Creating a Network Session
- Developing for Windows Phone and Xbox Live : Multiplayer Games (part 2) - Main Menu and State Management
- Developing for Windows Phone and Xbox Live : Multiplayer Games (part 1) - Getting Ready for Networking Development
- User Interface : Using the ApplicationBar Control
- User Interface : Creating an Animated Splash Screen
- Windows Phone 7 Game Development : The World of 3D Graphics - Vertex and Index Buffers
- Windows Phone 7 Game Development : The World of 3D Graphics - Hidden Surface Culling
- Windows Phone 7 Game Development : The World of 3D Graphics - The Depth Buffer
- Windows Phone 7 Game Development : The World of 3D Graphics - Rendering 3D Objects
- Windows Phone 7 Game Development : The World of 3D Graphics - Perspective Projection
- Developing for Windows Phone and Xbox Live : Let the 3D Rendering Start
- Developing for Windows Phone and Xbox Live : Reach and HiDef Graphics Profiles
- Developing for Windows Phone and Xbox Live : Graphics Pipeline
- Developing for Windows Phone and Xbox Live : Graphics Pipeline
- Programming Windows Phone 7 : Elements and Properties - More on Images
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us